package cn.haut.online_read.utils;

/**
 * @author xing
 * @date 2021-05-08 16:42
 */
public class Constant {
    /**
     * 返回状态码
     */
    public static final String CODE_KEY = "code";
    public static final int CODE_SUCCESS = 1 ;
    public static final int CODE_FAIL = 0;
    public static final int CODE_TOKEN_ERROR = 2;
    public static final String TOKEN_KEY = "token";

    /**
     * 权限
     */
    public static final int PERMIS_ADMIN = 2;
    public static final int PERMIS_USER = 1;

    /**
     * 返回消息， 状态码为 1 时不需要有，为 0 时需要有
     */
    public static final String MESSAGE_KEY = "msg";

    /**
     * 验证用户输入 正则表达式
     */
    public static final String USERNAME_REGEX = "^[0-9a-zA-Z_]{6,20}$";
    public static final String PASSWORD_REGEX = "^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$";

    /**
     * 书籍信息
     * TODO 考虑定义放入 书籍实体类
     */
    public static final String KEY_BOOK_ID = "id";
    public static final String KEY_BOOK_NAME = "name";
    public static final String KEY_BOOK_AUTHOR = "author";
    public static final String KEY_BOOK_DESC = "desc";
    public static final String KEY_BOOK_IMG_URL = "imgUrl";
    public static final String KEY_BOOK_KEEP = "keep";
    public static final String KEY_BOOK_POPULARITY = "popularity";

    /**
     * 分类
     */
    public static final String KEY_CLASSIFY_MAJOR = "major";
    public static final String KEY_CLASSIFY_MINOR = "minor";
}
